package com.lefevre.cms.bean.user;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * 角色
 *
 * @author Lefevre
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("user_role")
@Entity
@Table(name = "user_role")
public class UserRole implements Serializable {
    private static final long serialVersionUID = -2873847246959858813L;

    @Id
    @Column(length = 32)
    @TableId(type = IdType.INPUT)
    private String id;

    /**
     * 名称
     **/
    @Column(length = 50)
    private String name;

    /**
     * 备注
     **/
    @Lob
    private String remark;

    /**
     * 排序
     **/
    private Integer sort = 0;

    /**
     * 是否默认角色
     **/
    private Boolean defaultRole = false;

    /**
     * 资源 List<UserResourceGroup>的JSON格式值
     **/
    @Lob
    private String userResourceFormat;

    /**
     * 是否选中
     **/
    @Transient
    @TableField(exist = false)
    private boolean selected = false;

    /**
     * 有效期结束
     **/
    @Transient
    @TableField(exist = false)
    private Date validPeriodEnd;

}
